#pragma once
namespace Lumin {
namespace Win32 {
class CSerializeStream : public ISerializeStream , public CCounter
{
	friend CServer;
public:
	CSerializeStream(void);
	~CSerializeStream(void);
	static void *operator new(size_t objSize);
	static void operator delete(void *pObj, size_t bufferSize);
private:
	void AddRef();
	void Release();
	char* GetData(){return m_buffer;}
	void SetSize(int nSize){m_nSize=nSize;}
	int GetSize(){return m_nSize;}
	bool SetData(char* data,int size);
	bool PushData(char* data,int size);
	bool PopData(int size);
	ISerializeStream* Split(size_t length);
private:
	char* m_buffer;
	int m_nSize;
	volatile long m_ref;
};

}
}